#pragma once

#include <stdint.h>

#pragma pack(push, 1)
typedef  struct _rc
{
    uint8_t lx;

    uint8_t R1 : 1;
    uint8_t R2 : 1;
    uint8_t L1 : 1;
    uint8_t POWER : 1;
    uint8_t L3 : 1;
    uint8_t resv0 : 2;


    uint8_t ly;

    uint8_t Y : 1;
    uint8_t B : 1;
    uint8_t A : 1;
    uint8_t X : 1;
    uint8_t BT : 1;
    uint8_t resv1 : 3;

    uint8_t rx;

    uint8_t UP : 1;
    uint8_t DOWN : 1;
    uint8_t LEFT : 1;
    uint8_t RIGHT: 1;
    uint8_t START: 1;
    uint8_t R3 : 1;
    uint8_t resv2 : 2;

    uint8_t ry;
}rc_t;


#pragma pack(pop)


extern rc_t rc;
void parse_rc(uint8_t *buf, uint16_t len);
void rc_init();